﻿using AutoMapper;
using B.S.XZYData.Api.Wrter.Application.Command.Account;
using B.S.XZYData.Api.Wrter.Application.Command.Permission;
using B.S.XZYData.Api.Wrter.Application.Command.ZSH;
using B.S.XZYData.Domain.RBAC;
using B.S.XZYData.Domain.ZSH;

namespace B.S.XZYData.Api.Wrter
{
    /// <summary>
    /// AutoMapper映射层
    /// </summary>
    public class MyAutoMapper : Profile
    {
        public MyAutoMapper()
        {
            //新增映射
            CreateMap<AddPermissionCommand, PermissionModel>()
                .ReverseMap() //反转
                .ForMember(x=>x.PermissionName,x=>x.MapFrom(y=>y.PermissionName))
                .ForMember(x=>x.PermissionURL, x=>x.MapFrom(y=>y.PermissionURL));
            //修改映射
            CreateMap<UpdatePermissionCommand, PermissionModel>().ReverseMap();
            //用户新增映射
            CreateMap<AddAccountCommand,AccountModel>() .ReverseMap();
            //用户修改映射
            CreateMap<UpdateAccountCommand, AccountModel>().ReverseMap();

            // 不良品项新增/编辑映射
            CreateMap<AddDefectiveCommand, Defective>().ReverseMap();
            CreateMap<UpdateDefectiveCommand, Defective>().ReverseMap();
        }
    }
}
